//
//  WithdrawCheckingVC.swift
//  d11
//
//  Created by peale on 2018/11/15.
//  Copyright © 2018年 Tech_001. All rights reserved.
//

import UIKit

class WithdrawCheckingVC: BXBaseVC {
    var bgImageView:UIImageView?
    var iconImageView:UIImageView?
    var titleLabel:UILabel?
    var subTitleLabel:UILabel?
    var bankInfoBtn:UIButton?
    var newBtn:UIButton?
     var newbgImageView:UIImageView?
    var newTitleLabel:UILabel?
    var newIconImageView:UIImageView?
    var bankbgImageView :UIImageView?
    var bankIconImageView :UIImageView?
    var bankTitleLabel:UILabel?
    var bankAcountLabel:UILabel?
    var bankIconStr:String?
    var bankname:String?
    var cardnum:String?
    
    @objc override func currentViewControllerShouldPop() -> Bool {
        //跳转到首页
        self.navigationController?.popToRootViewController(animated: true)
        return false
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = ""
        let topLogo = UIImage(named: "icon_nav_left_logo")
        let titleView = UIView()
        let topLogoView = UIImageView(image: topLogo)
        titleView.addSubview(topLogoView)
        topLogoView.contentMode = .scaleToFill
        topLogoView.frame = CGRect(x: -(137/2), y:-(35/2), width: 137, height: 35)
        navigationItem.titleView = titleView
        
        self.view.backgroundColor = UIColor.white
         self.createSubView()
        self.bankIconImageView?.sd_setImage(with: URL.init(string: bankIconStr ?? ""), completed: nil)
        self.bankTitleLabel?.text = bankname ?? ""
        let number = cardnum ?? ""
        if number.count == 0{
            self.bankAcountLabel?.text = ""
        }else if number.count <= 4{
            self.bankAcountLabel?.text = "**** **** **** " + number
        }else{
            self.bankAcountLabel?.text = "**** **** **** " + number.suffix(4)
        }
    }

    func createSubView() -> Void {
        self.bgImageView = UIImageView.init()
        self.bgImageView?.image = imageNamed("icon_withdraw_checking_bg")
        self.view.addSubview(self.bgImageView!)
        self.bgImageView?.snp.makeConstraints{(make) in
            make.width.equalToSuperview()
            make.centerX.equalToSuperview()
            make.bottom.equalTo(self.view.snp.centerY).offset(-30)
             // make.height.equalTo(250)
            make.top.equalToSuperview()
        }
        
        self.iconImageView = UIImageView.init()
        self.iconImageView?.image = imageNamed("icon_withdraw_checking")
        self.bgImageView?.addSubview(self.iconImageView!)
        self.iconImageView?.snp.makeConstraints{(make) in
            make.width.equalTo(116)
            make.centerX.equalToSuperview()
             make.centerY.equalToSuperview().offset(-30)
            make.height.equalTo(116)
         //   make.top.equalToSuperview().offset(40)
        }
        
        self.titleLabel = UILabel.init()
        self.titleLabel?.text = "您的取款申请已经进入审核队列"
        self.titleLabel?.textColor = HexRGBAlpha(0x333333, 1)
        self.titleLabel?.textAlignment = .center
        self.titleLabel?.backgroundColor = UIColor.clear
        self.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
        self.view?.addSubview(self.titleLabel!)
        self.titleLabel?.snp.makeConstraints{(make) in
            make.width.equalToSuperview().offset(-20)
            make.centerX.equalToSuperview()
            make.height.equalTo(20)
            make.top.equalTo(self.view.snp.centerY)
          //  make.top.equalTo((self.bgImageView?.snp.bottom)!).offset(40)
        }
        
        self.subTitleLabel = UILabel.init()
        self.subTitleLabel?.text = "预计5分钟内财物部门会进行处理\n\n请稍等..."
        self.subTitleLabel?.textColor = HexRGBAlpha(0x999999, 1)
        self.subTitleLabel?.textAlignment = .center
        self.subTitleLabel?.backgroundColor = UIColor.clear
        self.subTitleLabel?.numberOfLines = 0
        self.subTitleLabel?.font = UIFont.systemFont(ofSize: 15)
        self.view?.addSubview(self.subTitleLabel!)
        
        self.subTitleLabel?.snp.makeConstraints{(make) in
            make.width.equalToSuperview().offset(-20)
            make.centerX.equalToSuperview()
            make.height.equalTo(80)
            make.top.equalTo((self.titleLabel?.snp.bottom)!).offset(10)
        }
        
//        self.newbgImageView = UIImageView.init()
//        self.newbgImageView?.image = imageNamed("icon_withdraw_checking_newAccount_bg")
//        self.view.addSubview(self.newbgImageView!)
//        self.newbgImageView?.snp.makeConstraints{(make) in
//            make.width.equalTo(96)
//            make.right.equalToSuperview()
//            make.height.equalTo(117.5)
//            make.top.equalTo((self.subTitleLabel?.snp.bottom)!).offset(10)
//        }
//        self.newIconImageView = UIImageView.init()
//        self.newIconImageView?.image = imageNamed("icon_withdraw_checking_add")
//        self.newbgImageView?.addSubview(self.newIconImageView!)
//        self.newIconImageView?.snp.makeConstraints{(make) in
//            make.width.equalTo(27)
//            make.centerX.equalToSuperview()
//            make.height.equalTo(27)
//            make.top.equalToSuperview().offset(35)
//        }
        
//        self.newTitleLabel = UILabel.init()
//        self.newTitleLabel?.text = "新建账户"
//        self.newTitleLabel?.textColor = HexRGBAlpha(0x666666, 1)
//        self.newTitleLabel?.textAlignment = .center
//        self.newTitleLabel?.backgroundColor = UIColor.clear
//        self.newTitleLabel?.font = UIFont.systemFont(ofSize: 14)
//        self.newbgImageView?.addSubview(self.newTitleLabel!)
//        self.newTitleLabel?.snp.makeConstraints{(make) in
//            make.width.equalTo(86)
//            make.centerX.equalToSuperview()
//            make.height.equalTo(20)
//            make.top.equalTo((self.newIconImageView?.snp.bottom)!).offset(15)
//        }
//        self.bankbgImageView = UIImageView.init()
//        self.bankbgImageView?.image = imageNamed("icon_withdraw_checking_bankInfo_bg")
//        self.view.addSubview(self.bankbgImageView!)
//        self.bankbgImageView?.snp.makeConstraints{(make) in
//            make.left.equalToSuperview()
//            make.right.equalTo((self.newbgImageView?.snp.left)!)
//            make.height.equalTo(117.5)
//            make.top.equalTo((self.newbgImageView?.snp.top)!)
//        }
        
        //
        
//        self.bankIconImageView = UIImageView.init()
//       // self.bankIconImageView?.image = imageNamed("icon_depoist_input_info_jh")
//        self.bankbgImageView?.addSubview(self.bankIconImageView!)
//        self.bankIconImageView?.snp.makeConstraints{(make) in
//            make.width.equalTo(20)
//            make.left.equalToSuperview().offset(25)
//            make.height.equalTo(20)
//            make.top.equalToSuperview().offset(35)
//        }
//
//        self.bankTitleLabel = UILabel.init()
//     //   self.bankTitleLabel?.text = "中国建设银行"
//        self.bankTitleLabel?.textColor = HexRGBAlpha(0x666666, 1)
//        self.bankTitleLabel?.textAlignment = .left
//        self.bankTitleLabel?.backgroundColor = UIColor.clear
//        self.bankTitleLabel?.font = UIFont.systemFont(ofSize: 14)
//        self.bankbgImageView?.addSubview(self.bankTitleLabel!)
//        self.bankTitleLabel?.snp.makeConstraints{(make) in
//            make.left.equalTo((self.bankIconImageView?.snp.right)!).offset(7)
//            make.right.equalToSuperview().offset(-5)
//            make.height.equalTo(20)
//            make.top.equalTo((self.bankIconImageView?.snp.top)!)
//        }
//
//        self.bankAcountLabel = UILabel.init()
//      //  self.bankAcountLabel?.text = "**** ***** **** 5985"
//        self.bankAcountLabel?.textColor = HexRGBAlpha(0x333333, 1)
//        self.bankAcountLabel?.textAlignment = .left
//        self.bankAcountLabel?.backgroundColor = UIColor.clear
//        self.bankAcountLabel?.font = UIFont.boldSystemFont(ofSize: 16)
//        self.bankbgImageView?.addSubview(self.bankAcountLabel!)
//        self.bankAcountLabel?.snp.makeConstraints{(make) in
//            make.left.equalTo((self.bankIconImageView?.snp.left)!)
//            make.right.equalToSuperview().offset(-5)
//            make.top.equalTo((self.bankTitleLabel?.snp.bottom)!).offset(15)
//            make.height.equalTo(20)
//        }
    }
}
